package Factory;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

//Singleton
/**
 * Makes the session factory into singleton accessible from everywhere
 * @author Shinichi
 *
 */
public class SFac {
	   private static SessionFactory instance = null;
	   protected SFac() {
	      // Exists only to defeat instantiation.
	   }
	   public static SessionFactory get() {
	      if(instance == null) {
	         instance = new Configuration().configure().buildSessionFactory();
	      }
	      return instance;
	   }
	}

